package com.jlect.swebing.ui.client;

/**
 * This class is the equivalent to the {@link java.beans.PropertyChangeEvent} with one difference: this object
 * is mutable
 *
 * @author Sergey Kozmin
 * @since 06.12.2007 10:35:01
 */
public class PropertyChangeEvent {
    private Object source;
    private String propertyName;
    private Object newValue;
    private Object oldValue;

    public PropertyChangeEvent(Object source, String propertyName, Object oldValue, Object newValue) {
        init(source, propertyName, oldValue, newValue);
    }

    public void init(Object source, String propertyName, Object oldValue, Object newValue) {
        this.source = source;
        this.propertyName = propertyName;
        this.newValue = newValue;
        this.oldValue = oldValue;
    }

    public String getPropertyName() {
        return propertyName;
    }

    public Object getNewValue() {
        return newValue;
    }

    public Object getOldValue() {
        return oldValue;
    }

    public Object getSource() {
        return source;
    }

    public void setSource(Object source) {
        this.source = source;
    }

    public void setPropertyName(String propertyName) {
        this.propertyName = propertyName;
    }

    public void setNewValue(Object newValue) {
        this.newValue = newValue;
    }

    public void setOldValue(Object oldValue) {
        this.oldValue = oldValue;
    }


    public String toString() {
        return "PropertyChangeEvent{" +
                "source=" + source +
                ", propertyName='" + propertyName + '\'' +
                ", newValue=" + newValue +
                ", oldValue=" + oldValue +
                '}';
    }
}
